<?php

namespace Aiweline\AiReviewForMagentoProduct\Helper;

use Weline\Framework\App\Env;
use Weline\SystemConfig\Model\SystemConfig;

class Config
{
    const module = 'Aiweline_AiReviewForMagentoProduct';
    const area = 'backend';

    public function __construct(
        private SystemConfig $systemConfig
    )
    {

    }

    function get($name)
    {
        $value = $this->systemConfig->getConfig($name ? 'ai_review_for_magento_product_config.' . $name : 'ai_review_for_magento_product_config', self::module, self::area);
        if (empty($value)) {
            return Env::module_env(self::module, $name);
        }
        return $value;
    }

    function set(string $name, string $data): bool
    {
        return $this->systemConfig->setConfig($name, $data, self::module, self::area);
    }
}